package com.yogee.core.base;

import com.trello.rxlifecycle.LifecycleTransformer;
import com.yogee.core.http.loading.CustomProgressDialog;
import com.yogee.core.utils.ToastUtils;

/**
 * 用于http请求的基类 Activity
 *
 * @author BiHaidong
 * @date 2016-12-09
 */
public abstract class HttpActivity1 extends BaseActivity implements HttpView {

    public CustomProgressDialog pd = null;
    protected int postCount = 0;
    protected int finishCount = 0;

    @Override
    public void onLoading() {
//        postCount++;
//        if (pd == null)
//            pd = CustomProgressDialog.createDialog(this);
//        else
//            pd.show();
    }

    @Override
    public void loadingFinished() {
//        finishCount++;
//        if (finishCount == postCount) {
//            if (pd != null)
//                pd.dismiss();
//        }
    }

    @Override
    public <T> LifecycleTransformer<T> bindRecycler() {
        return this.bindToLifecycle();
    }

    @Override
    public void showMsg(String msg) {
        ToastUtils.showToast(this, msg);
    }
}
